package model

import "time"

type ShoppingCart struct {
	BaseModel
	UserID  int32 `gorm:"type:int;index"`
	GoodsID int32 `gorm:"type:int;index"`
	Num     int32 `gorm:"type:int"`
	Checked bool
}

func (ShoppingCart) TableName() string {
	return "shoppingcart"
}

type OrderInfo struct {
	BaseModel
	UserID  int32  `gorm:"type:int;index"`
	OrderSn string `gorm:"type:varchar(30);index"`
	PayType string `gorm:"type:varchar(20) comment 'alipay(支付宝), wechat(微信)'"`

	Status      string `gorm:"type:varchar(20) comment 'PAYING(待支付), TRADE_SUCCESS(成功), TRADE_CLOSED(订单超时), WAIT_BUYER_PAY(交易创建), TRADE_FINISHED(交易结束)'"`
	TradeNo     string `gorm:"type:varchar(100) comment '交易号'"`
	OrderAmount float32
	PayTime     *time.Time `gorm:"type:datetime"`

	Address      string `gorm:"type:varchar(100)"`
	SignerName   string `gorm:"type:varchar(20)"`
	SignerMobile string `gorm:"type:varchar(11)"`
	Post         string `gorm:"type:varchar(20)"` // 留言信息
}

func (OrderInfo) TableName() string {
	return "orderinfo"
}

type OrderGoods struct {
	BaseModel

	OrderID int32 `gorm:"type:int;index"`
	GoodsID int32 `gorm:"type:int;index"`

	GoodsName  string `gorm:"type:varchar(100);index"`
	GoodsImage string `gorm:"type:varchar(200)"`
	GoodsPrice float32
	Num        int32 `gorm:"type:int"`
}

func (OrderGoods) TableName() string {
	return "ordergoods"
}
